** Online Appendix For: The Democratic State and Redistribution: Whose Interests Are Served?

* Appendix A: Dividing the Entire Income Distribution into Three Groups: Bottom 30%, Middle 40%, and Top 30%.
cd ""
use "data_analysis_final", clear

** Figure A1 and A4:
preserve 
* preparing the data
drop if year>2016

keep if red_t1_abs_disp!=.
keep country year red_* pdisp_* post_* pre_*

sort country year
bysort country: gen first=[_n]
replace first=0 if first!=1

gen nyear = -year
sort country nyear
bysort country: gen last=[_n]
replace last=0 if last!=1
drop nyear
sort country year

keep if first==1 | last==1

foreach v of varlist red_* pdisp_* post_* pre_*  {
g first_`v'=`v' if first==1
g last_`v'=`v' if last==1
bysort country: replace last_`v'=last_`v'[_n+1]
g d_`v'=last_`v'-first_`v'
g d_pct_`v'=(last_`v'-first_`v')/first_`v'
}
drop if first_red_m20_disp==.

keep country year d_* first_* last_*

* Figure A1:
graph hbar d_pre_p0p30  d_pre_p30p70 d_pre_p70p100 , ///
over(country, label(labsize(medium)) axis(noline noextend)) ytitle("% of national income", color(gray))  nofill bar(1, bcolor(red)) bar(2, bcolor(green)) bar(3, bcolor(blue)) ///
legend(order(1 2 3) label(1 "Bottom 30%") label(2 "Middle 40%") label(3 "Top 30%") placement(w) si(medium) region(lc(none) fc(none) ls(none)) keygap(*.5) colgap(*.5) symxs(*.5) row(3) position(6)) ///
   scheme(plotplain) ymtick(-.10(.025).10, labcolor(gray)) ylabel(-.10 "-10%" -.05 "-5%" 0 "0%" .05 "5%" .10 "10%", labcolor(gray) nogrid labsize(medium))  ///
   yline(0, lpattern(solid) lcolor(gray)) yscale(lcolor(gray)) graphregion(margin(0 0 0 0)) plotregion(margin(2.5 2.5 2.5 2.5)) xsize(8cm) ysize(10cm)
   restore

*Figure A2
set scheme s1mono

g year2=year+40

*** redistribution with lump-sum benefits
twoway ///
(scatter red_t30_abs_disp year if year<2017, ms(o) mfc(blue%10) mlc(blue%0) yaxis(1)) ///
(scatter red_m40_abs_disp year if year<2017, ms(o) mfc(green%10) mlc(green%0) yaxis(1)) ///
(scatter red_b30_abs_disp year if year<2017, ms(o) mfc(red%10) mlc(red%0) yaxis(1))  ///
(lpoly red_t30_abs_disp year if year<2017, lcolor(blue) lwidth(thick) yaxis(1))  ///
(lpoly red_m40_abs_disp year if year<2017, lcolor(green) lwidth(thick) yaxis(1)) ///
(lpoly red_b30_abs_disp year if year<2017, lcolor(red) lwidth(thick) yaxis(1)) ///
(scatter red_t30_absls year2 if year2<2057, ms(t) mfc(blue%10) mlc(blue%0) yaxis(1)) ///
(scatter red_m40_absls year2 if year2<2057, ms(t) mfc(green%10) mlc(green%0) yaxis(1)) ///
(scatter red_b30_absls year2 if year2<2057, ms(t) mfc(red%10) mlc(red%0) yaxis(1))  ///
(lpoly red_t30_absls year2 if year2<2057, lcolor(blue) lwidth(thick) yaxis(1))  ///
(lpoly red_m40_absls year2 if year2<2057, lcolor(green) lwidth(thick) yaxis(1)) ///
(lpoly red_b30_absls year2 if year2<2057, lcolor(red) lwidth(thick) yaxis(1)), ///
scheme(s1mono) legend(order(6 5 4) label(4 "Top 30%") label(5 "Middle 40%") label(6 "Bottom 30%") placement(w) si(medium) region(lc(none) fc(none) ls(none)) keygap(*.5) colgap(*.5) symxs(*.5) row(3) position(9)) ///
ymtick(-.14(.02).12, labcolor(gray)) ylabel(-.18 "-18%" -.16 "-16%" -.14 "-14%" -.12 "-12%" -.10 "-10%" -.08 "-8%" -.06 "-6%" -.04 "-4%" -.02 "-2%" 0 "0%" .02 "2%" .04 "4%" .06 "6%" .08 "8%" .10 "10%" .12 "12%", angle(horizontal) labsize(medium) labcolor(gray))  xline(2018, lcolor(gray)) ///
xtitle("Year", size(medium) color(gray)) ytitle("% of national income", size(medium) color(gray)) title("Absolute transfer shares", size(medium)) xmtick(1980(10)2055) xlabel(1980 "1980" 2000 "2000" 2020 "1980"  2040 "2000" , angle(horizontal) labsize(medium) labcolor(gray)) ysc(r(-.18 .12) axis(1)) text(-0.18 1998 "{bf: excl. in-kind benefits}", size(small)) text(-0.18 2038 "{bf: incl. in-kind benefits}", size(small))

graph save "fig_A2a", replace

twoway ///
(scatter red_t30_disp year if year<2017, ms(o) mfc(blue%10) mlc(blue%0)) ///
(scatter red_m40_disp year if year<2017, ms(o) mfc(green%10) mlc(green%0)) ///
(scatter red_b30_disp year if year<2017, ms(o) mfc(red%10) mlc(red%0))  ///
(lpoly red_t30_disp year if year<2017, lcolor(blue) lwidth(thick))  ///
(lpoly red_m40_disp year if year<2017, lcolor(green) lwidth(thick)) ///
(lpoly red_b30_disp year if year<2017, lcolor(red) lwidth(thick)) /// 
(scatter red_t30ls year2 if year2<2057, ms(t) mfc(blue%10) mlc(blue%0)) ///
(scatter red_m40ls year2 if year2<2057, ms(t) mfc(green%10) mlc(green%0)) ///
(scatter red_b30ls year2 if year2<2057, ms(t) mfc(red%10) mlc(red%0))  ///
(lpoly red_t30ls year2 if year2<2057, lcolor(blue) lwidth(thick))  ///
(lpoly red_m40ls year2 if year2<2057, lcolor(green) lwidth(thick)) ///
(lpoly red_b30ls year2 if year2<2057, lcolor(red) lwidth(thick)), ///
scheme(s1mono) legend(order(6 5 4) label(4 "Top 30%") label(5 "Middle 40%") label(6 "Bottom 30%") placement(w) si(medium) region(lc(none) fc(none) ls(none)) keygap(*.5) colgap(*.5) symxs(*.5) row(3) position(9)) ///
 xline(2018, lcolor(gray)) ///
xtitle("Year", size(medium) color(gray)) ytitle("% of post-tax income", size(medium) color(gray)) ysc(titlegap(-1)) title("Relative transfer shares", size(medium)) xmtick(1980(10)2055) xlabel(1980 "1980" 2000 "2000" 2020 "1980"  2040 "2000" , angle(horizontal) labsize(medium) labcolor(gray)) ysc(r(-40 70))  ymtick(-40(20)60, ) ylabel(-40 "-40%" -20 "-20%" 0 "0%" 20 "20%" 40 "40%" 60 "60%",  angle(horizontal) labsize(medium) labcolor(gray)) text(-40 1998 "{bf: excl. in-kind benefits}", size(small)) text(-40 2038 "{bf: incl. in-kind benefits}", size(small))

graph save "fig_A2b", replace

grc1leg2 "fig_A2a" "fig_A2b",  labsize(small) position(6)



** Average income growth
drop if alspost_p0p20==.

drop if country=="Austria" & year<2004
drop ccode
encode country, g(ccode)
xtset ccode year

* Real extended income growth
sort country year
bysort country: gen index_ext_b30ls = 100*alspost_p0p30/alspost_p0p30[1] // baseline growth rate; base 100 = 1980
bysort country: gen index_ext_m40ls = 100*alspost_p30p70/alspost_p30p70[1] // baseline growth rate; base 100 = 1980
bysort country: gen index_ext_mean = 100*apost_p0p100/apost_p0p100[1] // baseline growth rate; base 100 = 1980

** calculating average for Europe, exclusive of Belgium and Austria. 
 preserve
 g full_sample_eu=1 if country!="Belgium" & country!="United States" & country!="Austria"
 drop if full_sample_eu!=1 | year>2016 | year<1982

 sort year
 
 bysort year: egen eu_index_ext_mean=mean(index_ext_mean)
 bysort year: egen eu_index_ext_m40ls=mean(index_ext_m40ls)
 bysort year: egen eu_index_ext_b30ls=mean(index_ext_b30ls) 
 
 duplicates drop year, force
 
 sort year
 
 replace country="Europe"
 keep country year eu_index*
 
 
 ren eu_index_ext_mean index_ext_mean
 ren eu_index_ext_b30ls index_ext_b30ls
  ren eu_index_ext_m40ls index_ext_m40ls
  save "real_ext_income_eu14_b30m40t30", replace
restore 

append using "real_ext_income_eu14_b30m40t30"

 encode country, g(c)
 tab c
* rearranging so that Europe will show up last next to US.  
 recode c (1=5 "Austria") (2=6 "Belgium") (3=1 "Denmark") (4=18 "Europe") (5=2 "Finland") (6=7 "France") (7=8 "Germany") (8=11 "Greece") ///
 (9=15 "Ireland") (10=12 "Italy") (11=10 "Netherlands") (12=3 "Norway") (13=13 "Portugal") (14=14 "Spain") (15=4 "Sweden") (16=9 "Switzerland") ///
 (17=16 "UK") (18=17 "US"), g(c2)



* setting up the figure
grstyle init
grstyle set plain, horizontal grid
grstyle set margin "0 0 0 0", cm: graph
grstyle set linewidth 0pt: axisline tick legend xyline
grstyle set legend 9, nobox

* Figure A3
twoway ///
(line index_ext_mean year, by(c2, r(2) im(.5 .5 1 1) note(""))   lcolor(blue) lpattern(solid)) ///
(line index_ext_m40ls year,   lcolor(green) lpattern(solid)) ///
(line index_ext_b30ls year,  lcolor(red) lpattern(solid)), ///
ylabel(100(50)250, angle(horizontal) labsize(medium) labcolor(gray)) ysc(r(75 250)) ///
xtitle("", size(medium)) ytitle("Post-tax income growth (base 100=1980)", size(small)) xlabel(1980 " " 1990 "1990" 2000 " " 2010 "2010" 2020 " ", angle(horizontal) labsize(medium) labcolor(gray)) subtitle(,size(large)) ///
legend(order(1 "Overall average" 2 "Middle 40%" 3 "Bottom 30%") placement(w) si(vsmall) region(lc(none) ///
   fc(none) ls(none)) keygap(*.3) colgap(*.3) symxs(*.3) row(3)) xtitle("") graphregion(margin(0 0 0 0)) plotregion(margin(2 2 2 2)) xsize(16cm) ysize(10cm)
 
 
** Regression results when dividing the entire income distribution intro three groups: b30, m40, and t30.
use "data_analysis_final", clear

g top_inequality_t30m40 = pre_p70p100/pre_p30p70
g bottom_inequality_b30m40 = pre_p30p70/pre_p0p30

xtset ccode year 

* dropping the outliers in CH in 2008 and 2009 
drop if country=="Switzerland" & year>2007 & year<2010
 
* Table A1
xtpcse d.red_t30_disp l1.red_t30_disp  d1.top_inequality_t30m40 l1.top_inequality_t30m40 d1.bottom_inequality_b30m40 l1.bottom_inequality_b30m40 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d.red_t30ls l1.red_t30ls  d1.top_inequality_t30m40 l1.top_inequality_t30m40 d1.bottom_inequality_b30m40 l1.bottom_inequality_b30m40 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d.red_m40_disp l1.red_m40_disp  d1.top_inequality_t30m40 l1.top_inequality_t30m40 d1.bottom_inequality_b30m40 l1.bottom_inequality_b30m40 d1.ikaopen l1.ikaopen d1.iopenc  l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d.red_m40ls l1.red_m40ls  d1.top_inequality_t30m40 l1.top_inequality_t30m40 d1.bottom_inequality_b30m40 l1.bottom_inequality_b30m40 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d.red_b30_disp l1.red_b30_disp d1.top_inequality_t30m40 l1.top_inequality_t30m40 d1.bottom_inequality_b30m40 l1.bottom_inequality_b30m40 d1.ikaopen l1.ikaopen d1.iopenc  l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp  i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d.red_b30ls l1.red_b30ls d1.top_inequality_t30m40 l1.top_inequality_t30m40 d1.bottom_inequality_b30m40 l1.bottom_inequality_b30m40 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append


************

* Appendix B: How May Governments Affect "Predistribution"?

*** Table B1:
use "WID_pre_tax_Gini.dta", clear

replace country="United States" if country=="USA"

merge 1:1 country year using "data_analysis_final"

xtset ccode year

g gdp_cap2=gdp_cap/10000

* table B1:
xtpcse  d1.pre_gini l1.pre_gini d1.red_b20_abs_disp l1.red_b20_abs_disp d1.red_m20_abs_disp l1.red_m20_abs_disp  d1.cum_left l1.cum_left  d1.educexp_gov_ipol l1.educexp_gov_ipol d1.unemp l1.unemp  d1.gdp_cap2 l1.gdp_cap2 i.ccode, p
outreg2 using regressions,  word  bd(4) sd(4) rd(4) alpha(0.05, .1) symbol(*, +)  lab replace

xtpcse  d1.pre_gini l1.pre_gini d1.red_b20_abs_disp l1.red_b20_abs_disp d1.red_m20_abs_disp l1.red_m20_abs_disp d1.cum_left l1.cum_left  d1.educexp_gov_ipol l1.educexp_gov_ipol d1.unemp l1.unemp  d1.gdp_cap2 l1.gdp_cap2 trend i.ccode, p
outreg2 using regressions,  word  bd(4) sd(4) rd(4) alpha(0.05, .1) symbol(*, +)  lab append

xtpcse  d1.pre_gini l1.pre_gini d1.red_b20_abs_disp l1.red_b20_abs_disp d1.red_m20_abs_disp l1.red_m20_abs_disp d1.cum_left l1.cum_left  d1.educexp_gov_ipol l1.educexp_gov_ipol d1.unemp l1.unemp  d1.gdp_cap2 l1.gdp_cap2 c.trend##i.ccode, p
outreg2 using regressions,  word  bd(4) sd(4) rd(4) alpha(0.05, .1) symbol(*, +)  lab append


************

* Appendix C: Spending and Generosity of Replacement Income Programs

use "cwed.dta", clear

* country sample
g s=1 if country=="Austria"
replace s=1 if country=="Belgium"
replace s=1 if country=="Denmark"
replace s=1 if country=="Finland"
replace s=1 if country=="France"
replace s=1 if country=="Germany"
replace s=1 if country=="Greece"
replace s=1 if country=="Ireland"
replace s=1 if country=="Italy"
replace s=1 if country=="Netherlands"
replace s=1 if country=="Norway"
replace s=1 if country=="Portugal"
replace s=1 if country=="Spain"
replace s=1 if country=="Sweden"
replace s=1 if country=="Switzerland"
replace s=1 if country=="United Kingdom"
replace s=1 if country=="United States"
replace s=0 if s!=1

keep if s==1

drop if year<1980

merge 1:1 country year using "data_analysis_final"
drop _merge

preserve
drop if country=="Switzerland" & year>2007 & year<2010

xtset ccode year

* Table C1
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.uegen l1.uegen i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni  d1.uegen l1.uegen i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp  d1.uegen l1.uegen i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni  d1.uegen l1.uegen i.ccode, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp  d1.uegen l1.uegen i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni  d1.uegen l1.uegen i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append
restore


** Creating Figure C1
* setting up the figures
set scheme s2color
grstyle init
grstyle set plain, horizontal grid
grstyle set margin "0 0 0 0", cm: graph
grstyle set linewidth 0pt: axisline tick legend xyline
grstyle set legend 9, nobox

* Figure C1, top panel
**** Unemploument Generosity
preserve
* uegen:
drop if year<1980 | year>2010
drop if uegen==.
sort country year
bysort country: gen first=[_n]
replace first=0 if first!=1

gen nyear = -year
sort country nyear
bysort country: gen last=[_n]
replace last=0 if last!=1
drop nyear
sort country year

keep if first==1 | last==1

foreach v of varlist uegen  {
g first_`v'=`v' if first==1
g last_`v'=`v' if last==1
bysort country: replace last_`v'=last_`v'[_n+1]
g d_`v'=last_`v'-first_`v'
g d_pct_`v'=(last_`v'-first_`v')/first_`v'
}
drop if first_uegen==.

keep country year d_* first_* last_*


g m_0="SE" if country=="Sweden"
replace m_0="UK" if country=="United Kingdom"
replace m_0="DE" if country=="Germany"

twoway (scatter last_uegen first_uegen, mlabel(m_0) mlabp(6) mlabsize(medium)) (function y=x, ra( 0 20) color(black)), legend(off) ytitle("Unemployment generosity 2010", size(vlarge)) xtitle("Unemployment generosity 1980", size(vlarge)) title("Change in unemployment" "generosity 1980 to 2010", size(vlarge)) xlabel(, labsize(vlarge)) ylabel(, labsize(vlarge))
graph save "uegen_1980_2010", replace
restore 

***** Pension generosity
preserve
* pgen:
drop if year<1980 | year>2010
drop if pgen==.
*drop if year<1985 | year>2010
sort country year
bysort country: gen first=[_n]
replace first=0 if first!=1

gen nyear = -year
sort country nyear
bysort country: gen last=[_n]
replace last=0 if last!=1
drop nyear
sort country year

keep if first==1 | last==1

foreach v of varlist pgen  {
g first_`v'=`v' if first==1
g last_`v'=`v' if last==1
bysort country: replace last_`v'=last_`v'[_n+1]
g d_`v'=last_`v'-first_`v'
g d_pct_`v'=(last_`v'-first_`v')/first_`v'
}
drop if first_pgen==.

keep country year d_* first_* last_*


g m_1="SE" if country=="Sweden"

g m_2="SE" if country=="Sweden"
replace m_2="DK" if country=="Denmark"

twoway (scatter last_pgen first_pgen, mlabel(m_1) mlabsize(medium)) (function y=x, ra( 5 20) color(black)), legend(off)  ytitle("Pension generosity 2010", size(vlarge)) xtitle("Pension generosity 1980", size(vlarge)) title("Change in pension" "generosity 1980 to 2010", size(vlarge)) xlabel(, labsize(vlarge)) ylabel(, labsize(vlarge))
graph save "pgen_1980_2010", replace
restore 


**** Sickness generosity
preserve
drop if year<1980 | year>2010
drop if skgen==.
*drop if year<1985 | year>2010
sort country year
bysort country: gen first=[_n]
replace first=0 if first!=1

gen nyear = -year
sort country nyear
bysort country: gen last=[_n]
replace last=0 if last!=1
drop nyear
sort country year

keep if first==1 | last==1

foreach v of varlist skgen  {
g first_`v'=`v' if first==1
g last_`v'=`v' if last==1
bysort country: replace last_`v'=last_`v'[_n+1]
g d_`v'=last_`v'-first_`v'
g d_pct_`v'=(last_`v'-first_`v')/first_`v'
}
drop if first_skgen==.

keep country year d_* first_* last_*


g m_2="SE" if country=="Sweden"
replace m_2="DK" if country=="Denmark"


twoway (scatter last_skgen first_skgen, mlabel(m_2) mlabsize(medium)) (function y=x, ra( 0 20) color(black)), legend(off)  ytitle("Sickness generosity 2010", size(vlarge)) xtitle("Sick pay program generosity 1980", size(vlarge)) title("Change in sick pay program" "generosity 1980 to 2010", size(vlarge)) xlabel(, labsize(vlarge)) ylabel(, labsize(vlarge))
graph save "skgen_1980_2010", replace
restore 

graph combine "uegen_1980_2010" "pgen_1980_2010"  "skgen_1980_2010", r(1) xsize(15) ysize(5)
graph export "welfare_program_generosity_1980_2010.pdf", replace

** Figure C1, bottom panel 
** OECD
import delimited "SOCX_AGG_24032021112147975.csv", encoding(UTF-8) clear 

kountry country, from(iso3c)
ren country cntry
ren NAMES_STD country

keep country year v4 unit value
sort country v4 unit year 

keep if unit=="PCT_GDP"
drop unit

keep if year==1980 | year==2017 | (country=="France" & year==1985 & v4=="Unemployment") | (country=="Ireland" & year==1985 & v4=="Unemployment")

sort country  v4 year
drop if country=="France" & year==1980 & v4=="Unemployment"
drop if country=="Ireland" & year==1980 & v4=="Unemployment"

bysort country v4: gen first=[_n]
replace first=0 if first!=1

gen nyear = -year
sort country v4 nyear
bysort country v4: gen last=[_n]
replace last=0 if last!=1
drop nyear
sort country v4 year

keep if first==1 | last==1

foreach v of varlist value  {
g first_`v'=`v' if first==1
g last_`v'=`v' if last==1
bysort country v4: replace last_`v'=last_`v'[_n+1]
g d_`v'=last_`v'-first_`v'
g d_pct_`v'=(last_`v'-first_`v')/first_`v'
}
drop if first_value==.

keep country v4 year d_* first_* last_*

g m_0="US" if country=="United States"
replace m_0="UK" if country=="United Kingdom"
replace m_0="IE" if country=="Ireland"
replace m_0="FI" if country=="Finland"
replace m_0="BE" if country=="Belgium"
replace m_0="ES" if country=="Spain"
replace m_0="FR" if country=="France"
replace m_0="NL" if country=="Netherlands"

twoway (scatter last_value first_value if v4=="Unemployment", mlabel(m_0) mlabsize(large)) (function y=x, ra( 0 4) color(black)), legend(off) ytitle("Unemployment spending 2017", size(vlarge)) xtitle("Unemployment spending 1980", size(vlarge)) title("Spending on unemployment" "as % of GDP 1980 to 2017", size(vlarge)) xlabel(, labsize(vlarge)) ylabel(, labsize(vlarge))
graph save "unemp_spend_1980_2017", replace

g m_1="PT" if country=="Portugal"
replace m_1="GR" if country=="Greece"
replace m_1="IT" if country=="Italy"
replace m_1="FI" if country=="Finland"
replace m_1="FR" if country=="France"
replace m_1="IE" if country=="Ireland"
replace m_1="DE" if country=="Germany"

twoway (scatter last_value first_value if v4=="Old age", mlabel(m_1) mlabsize(large)) (function y=x, ra( 0 15) color(black)), legend(off) ytitle("Old age spending 2017", size(vlarge)) xtitle("Old age spending 1980", size(vlarge)) title("Spending on old age" "as % of GDP 1980 to 2017", size(vlarge)) xlabel(, labsize(vlarge)) ylabel(, labsize(vlarge))
graph save "oldage_spend_1980_2017", replace

g m_2="NL" if country=="Netherlands"

twoway (scatter last_value first_value if v4=="Incapacity related", mlabel(m_2) mlabsize(large)) (function y=x, ra( 0 8) color(black)), legend(off) ytitle("Incapacity related spending 2017", size(vlarge)) xtitle("Incapacity related spending 1980", size(vlarge)) title("Incapacity related spending" "as % of GDP 1980 to 2017", size(vlarge)) xlabel(, labsize(vlarge)) ylabel(, labsize(vlarge))
graph save "Incapacity_spend_1980_2017", replace

graph combine "unemp_spend_1980_2017" "oldage_spend_1980_2017"  "Incapacity_spend_1980_2017", r(1) xsize(15) ysize(5)

************

* Appendix D: Additional Figures

use "data_analysis_final", clear

* setting up the figures
grstyle init
grstyle set plain, horizontal grid
grstyle set margin "0 0 0 0", cm: graph
grstyle set linewidth 0pt: axisline tick legend xyline
grstyle set legend 6, nobox

* Figure D1
twoway ///
(line red_t1_abs_disp year, by(country, im(.5 .5 1 1) note(""))   lcolor(blue) lpattern(solid)) ///
(line red_t1_abs year,   lcolor(green) lpattern(solid)) ///
(line red_t1_absls year,  lcolor(red) lpattern(solid)), ///
ylabel(0 "0" -0.02 "-2" -0.04 "-4" -0.06 "-6" -0.08 "-8", angle(horizontal) labsize(medium) labcolor(gray)) ///
xtitle("", size(medium)) ytitle("% of national income", size(small) color(gray)) xlabel(1980 " " 1990 "1990" 2000 " " 2010 "2010" 2020 " ", angle(horizontal) labsize(medium) labcolor(gray)) subtitle(,size(large)) ///
legend(order(1 "Excluding in-kind benefits" 2 "In-kind spending on health distributed lump sum" 3 "All in-kind spending distributed lump sum")   si(vsmall) region(lc(none) ///
   fc(none) ls(none)) keygap(*.3) colgap(*.3) symxs(*.3) row(3)) xtitle("") graphregion(margin(0 0 0 0)) plotregion(margin(2 2 2 2)) xsize(16cm) ysize(10cm)
   
 
* Figure D2
twoway ///
(line red_m20_abs_disp year, by(country, im(.5 .5 1 1) note(""))   lcolor(blue) lpattern(solid)) ///
(line red_m20_abs year,   lcolor(green) lpattern(solid)) ///
(line red_m20_absls year,  lcolor(red) lpattern(solid)), ///
ylabel(0 "0" 0.01 "1" 0.02 "2" 0.03 "3" 0.04 "4", angle(horizontal) labsize(medium) labcolor(gray)) ///
xtitle("", size(medium)) ytitle("% of national income", size(small) color(gray)) xlabel(1980 " " 1990 "1990" 2000 " " 2010 "2010" 2020 " ", angle(horizontal) labsize(medium) labcolor(gray)) subtitle(,size(large)) ///
legend(order(1 "Excluding in-kind benefits" 2 "In-kind spending on health distributed lump sum" 3 "All in-kind spending distributed lump sum") placement(w) si(vsmall) region(lc(none) ///
   fc(none) ls(none)) keygap(*.3) colgap(*.3) symxs(*.3) row(3)) xtitle("") graphregion(margin(0 0 0 0)) plotregion(margin(2 2 2 2)) xsize(16cm) ysize(10cm)
   

* Figure D3
twoway ///
(line red_b20_abs_disp year, by(country, im(.5 .5 1 1) note(""))   lcolor(blue) lpattern(solid)) ///
(line red_b20_abs year,   lcolor(green) lpattern(solid)) ///
(line red_b20_absls year,  lcolor(red) lpattern(solid)), ///
ylabel(0 "0" 0.02 "2" 0.04 "4" 0.06 "6" 0.08 "8", angle(horizontal) labsize(medium) labcolor(gray)) ///
xtitle("", size(medium)) ytitle("% of national income", size(small) color(gray)) xlabel(1980 " " 1990 "1990" 2000 " " 2010 "2010" 2020 " ", angle(horizontal) labsize(medium) labcolor(gray)) subtitle(,size(large)) ///
legend(order(1 "Excluding in-kind benefits" 2 "In-kind spending on health distributed lump sum" 3 "All in-kind spending distributed lump sum") placement(w) si(vsmall) region(lc(none) ///
   fc(none) ls(none)) keygap(*.3) colgap(*.3) symxs(*.3) row(3)) xtitle("") graphregion(margin(0 0 0 0)) plotregion(margin(2 2 2 2)) xsize(16cm) ysize(10cm)

   
* Figure D4-D5
use "WID_post_tax_Gini.dta", clear

merge 1:1 country year using "WID_pre_tax_Gini.dta"
drop _merge

* relative redistribution
g rel_red=(pre_gini-post_gini)/pre_gini*100

drop if year<2004 & country=="Austria"
drop if year<1991 & country=="Belgium"

* setting up the figure
grstyle init
grstyle set plain, horizontal grid
grstyle set margin ".1 .1 .1 .1", cm: graph
grstyle set linewidth 0pt: axisline tick legend xyline
grstyle set legend 6, nobox

* Figure D4
twoway line pre_gini post_gini year, by(country, note("")) ylabel(0(.2).6) ytitle(Gini coefficients) xtitle("") legend(order(1 2) label(1 "Pre-tax Gini") label(2 "Post-tax Gini") r(2))

* Figure D5
twoway line rel_red year, by(country, note("")) ylabel(0(10)40) ytitle(Redistribution (percentage change in Gini)) xtitle("") 


* The code to create Figure D6 is in the "3_analysis" do-file. 
   
  
* Figures D7-D8: absolute transfer rates
use "data_analysis_final", clear

* absolute redistribution: rescaling
foreach v of varlist red_t1_abs_disp red_t1_absls   red_t10_abs_disp red_t10_absls  red_t20_abs_disp red_t20_absls red_m20_abs_disp  red_m20_absls  red_b20_abs_disp red_b20_absls {
	replace `v'=`v'*100
}


* dropping the outlier years in CH
drop if country=="Switzerland" & year>2007 & year<2010

* demeaning (by country) the variables
foreach v of varlist top_inequality top_inequality_t10 top_inequality_t20 bottom_inequality_b20 ikaopen iopenc  cum_left  imarriage_rate pb_ni red_t1_abs_disp red_t1_absls red_t10_abs_disp red_t10_absls  red_t20_abs_disp red_t20_absls red_m20_abs_disp red_m20_absls red_b20_abs_disp red_b20_absls {
bysort country: egen mean_`v' = mean(`v')
g dm_`v' = .
replace dm_`v' = (`v'-mean_`v')
su dm_`v'
g std_`v'=`v'/`r(sd)'
}

****
xtset ccode year
****
tab ccode, g(c)
****

* Top 1% - excluding public goods
ivreg red_t1_abs_disp d1.std_top_inequality std_top_inequality d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.unemp unemp c2-c17 (d.red_t1_abs_disp =  l1.red_t1_abs_disp  std_top_inequality l1.std_top_inequality std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate unemp l1.unemp c2-c17)

matrix Hd=r(table)'
matrix list Hd

g top_inequality_pe3=Hd[3,1]
g top_inequality_ll3=Hd[3,5]
g top_inequality_hl3=Hd[3,6]

g bottom_inequality_pe3=Hd[5,1]
g bottom_inequality_ll3=Hd[5,5]
g bottom_inequality_hl3=Hd[5,6]

g cum_left_pe3=Hd[11,1]
g cum_left_ll3=Hd[11,5]
g cum_left_hl3=Hd[11,6]

* Top 1% - including public goods
ivreg red_t1_absls d1.std_top_inequality std_top_inequality d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.std_pb_ni std_pb_ni d1.unemp unemp c2-c17 (d.red_t1_absls = l1.red_t1_absls  std_top_inequality l1.std_top_inequality std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate std_pb_ni l1.std_pb_ni unemp l1.unemp c2-c17)

matrix H=r(table)'
matrix list H

g top_inequality_pe6=H[3,1]
g top_inequality_ll6=H[3,5]
g top_inequality_hl6=H[3,6]

g bottom_inequality_pe6=H[5,1]
g bottom_inequality_ll6=H[5,5]
g bottom_inequality_hl6=H[5,6]

g cum_left_pe6=H[11,1]
g cum_left_ll6=H[11,5]
g cum_left_hl6=H[11,6]

g pb_ni_pe6=H[15,1]
g pb_ni_ll6=H[15,5]
g pb_ni_hl6=H[15,6]

* Top 10% - excluding public goods
ivreg red_t10_abs_disp d1.std_top_inequality_t10 std_top_inequality_t10 d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.unemp unemp c2-c17 (d.red_t10_abs_disp = l1.red_t10_abs_disp  std_top_inequality_t10 l1.std_top_inequality_t10 std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate unemp l1.unemp c2-c17)

matrix Hdt10=r(table)'
matrix list Hdt10

g top_inequality_pe10=Hdt10[3,1]
g top_inequality_ll10=Hdt10[3,5]
g top_inequality_hl10=Hdt10[3,6]

g bottom_inequality_pe10=Hdt10[5,1]
g bottom_inequality_ll10=Hdt10[5,5]
g bottom_inequality_hl10=Hdt10[5,6]

g cum_left_pe10=Hdt10[11,1]
g cum_left_ll10=Hdt10[11,5]
g cum_left_hl10=Hdt10[11,6]

* Top 10% - including public goods
ivreg red_t10_absls d1.std_top_inequality_t10 std_top_inequality_t10 d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate  d1.std_pb_ni std_pb_ni d1.unemp unemp c2-c17 (d.red_t10_absls = l1.red_t10_absls  std_top_inequality_t10 l1.std_top_inequality_t10 std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate std_pb_ni l1.std_pb_ni unemp l1.unemp c2-c17)

matrix Ht10=r(table)'
matrix list Ht10

g top_inequality_pe11=Ht10[3,1]
g top_inequality_ll11=Ht10[3,5]
g top_inequality_hl11=Ht10[3,6]

g bottom_inequality_pe11=Ht10[5,1]
g bottom_inequality_ll11=Ht10[5,5]
g bottom_inequality_hl11=Ht10[5,6]

g cum_left_pe11=Ht10[11,1]
g cum_left_ll11=Ht10[11,5]
g cum_left_hl11=Ht10[11,6]

g pb_ni_pe11=Ht10[15,1]
g pb_ni_ll11=Ht10[15,5]
g pb_ni_hl11=Ht10[15,6]


* Top 20% - excluding public goods
ivreg red_t20_abs_disp d1.std_top_inequality_t20 std_top_inequality_t20 d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.unemp unemp c2-c17 (d.red_t20_abs_disp = l1.red_t20_abs_disp  std_top_inequality_t20 l1.std_top_inequality_t20 std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate unemp l1.unemp c2-c17)

matrix Hdt20=r(table)'
matrix list Hdt20

g top_inequality_pe20=Hdt20[3,1]
g top_inequality_ll20=Hdt20[3,5]
g top_inequality_hl20=Hdt20[3,6]

g bottom_inequality_pe20=Hdt20[5,1]
g bottom_inequality_ll20=Hdt20[5,5]
g bottom_inequality_hl20=Hdt20[5,6]

g cum_left_pe20=Hdt20[11,1]
g cum_left_ll20=Hdt20[11,5]
g cum_left_hl20=Hdt20[11,6]

* Top 20% - including public goods
ivreg red_t20_absls d1.std_top_inequality_t20 std_top_inequality_t20 d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate  d1.std_pb_ni std_pb_ni d1.unemp unemp c2-c17 (d.red_t20_absls = l1.red_t20_absls  std_top_inequality_t20 l1.std_top_inequality_t20 std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate std_pb_ni l1.std_pb_ni unemp l1.unemp c2-c17)

matrix Ht20=r(table)'
matrix list Ht20

g top_inequality_pe21=Ht20[3,1]
g top_inequality_ll21=Ht20[3,5]
g top_inequality_hl21=Ht20[3,6]

g bottom_inequality_pe21=Ht20[5,1]
g bottom_inequality_ll21=Ht20[5,5]
g bottom_inequality_hl21=Ht20[5,6]

g cum_left_pe21=Ht20[11,1]
g cum_left_ll21=Ht20[11,5]
g cum_left_hl21=Ht20[11,6]

g pb_ni_pe21=Ht20[15,1]
g pb_ni_ll21=Ht20[15,5]
g pb_ni_hl21=Ht20[15,6]


* Middle 20% - excluding public goods
ivreg red_m20_abs_disp d1.std_top_inequality std_top_inequality d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.unemp unemp c2-c17 (d.red_m20_abs_disp = l1.red_m20_abs_disp  std_top_inequality l1.std_top_inequality std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate unemp l1.unemp c2-c17)

matrix Md=r(table)'
matrix list Md

g top_inequality_pe2=Md[3,1]
g top_inequality_ll2=Md[3,5]
g top_inequality_hl2=Md[3,6]

g bottom_inequality_pe2=Md[5,1]
g bottom_inequality_ll2=Md[5,5]
g bottom_inequality_hl2=Md[5,6]

g cum_left_pe2=Md[11,1]
g cum_left_ll2=Md[11,5]
g cum_left_hl2=Md[11,6]

* Middle 20% - including public goods
ivreg red_m20_absls d1.std_top_inequality std_top_inequality d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.std_pb_ni std_pb_ni d1.unemp unemp c2-c17 (d.red_m20_absls = l1.red_m20_absls  std_top_inequality l1.std_top_inequality std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate std_pb_ni l1.std_pb_ni unemp l1.unemp c2-c17)

matrix M=r(table)'
matrix list M

g top_inequality_pe5=M[3,1]
g top_inequality_ll5=M[3,5]
g top_inequality_hl5=M[3,6]

g bottom_inequality_pe5=M[5,1]
g bottom_inequality_ll5=M[5,5]
g bottom_inequality_hl5=M[5,6]

g cum_left_pe5=M[11,1]
g cum_left_ll5=M[11,5]
g cum_left_hl5=M[11,6]

g pb_ni_pe5=M[15,1]
g pb_ni_ll5=M[15,5]
g pb_ni_hl5=M[15,6]


* Bottom 20% - excluding public goods
ivreg red_b20_abs_disp d1.std_top_inequality std_top_inequality d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.unemp unemp c2-c17 (d.red_b20_abs_disp = l1.red_b20_abs_disp  std_top_inequality l1.std_top_inequality std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate unemp l1.unemp c2-c17)

matrix Ld=r(table)'
matrix list Ld

g top_inequality_pe1=Ld[3,1]
g top_inequality_ll1=Ld[3,5]
g top_inequality_hl1=Ld[3,6]

g bottom_inequality_pe1=Ld[5,1]
g bottom_inequality_ll1=Ld[5,5]
g bottom_inequality_hl1=Ld[5,6]

g cum_left_pe1=Ld[11,1]
g cum_left_ll1=Ld[11,5]
g cum_left_hl1=Ld[11,6]

* Bottom 20% - including public goods
ivreg red_b20_absls d1.std_top_inequality std_top_inequality d1.std_bottom_inequality_b20 std_bottom_inequality_b20 d1.ikaopen ikaopen d1.iopenc iopenc  d1.std_cum_left std_cum_left d1.imarriage_rate imarriage_rate d1.std_pb_ni std_pb_ni d1.unemp unemp c2-c17 (d.red_b20_absls = l1.red_b20_absls  std_top_inequality l1.std_top_inequality std_bottom_inequality_b20 l1.std_bottom_inequality_b20 ikaopen l1.ikaopen iopenc l1.iopenc  std_cum_left l1.std_cum_left imarriage_rate l1.imarriage_rate std_pb_ni l1.std_pb_ni unemp l1.unemp c2-c17)

matrix L=r(table)'
matrix list L

g top_inequality_pe4=L[3,1]
g top_inequality_ll4=L[3,5]
g top_inequality_hl4=L[3,6]

g bottom_inequality_pe4=L[5,1]
g bottom_inequality_ll4=L[5,5]
g bottom_inequality_hl4=L[5,6]

g cum_left_pe4=L[11,1]
g cum_left_ll4=L[11,5]
g cum_left_hl4=L[11,6]

g pb_ni_pe4=L[15,1]
g pb_ni_ll4=L[15,5]
g pb_ni_hl4=L[15,6]

* keeping the saved estimates
keep top_inequality* bottom_inequality* cum_left* pb_ni*
* dropping these variables so dataframe consists only of saved estimates
drop top_inequality top_inequality_t10 top_inequality_t20 bottom_inequality_b20  cum_left pb_ni
* deleting all the duplicates
duplicates drop top_inequality_pe2, force

* reformatting to long
g ind=1
reshape long top_inequality_pe top_inequality_ll top_inequality_hl bottom_inequality_pe bottom_inequality_ll bottom_inequality_hl  cum_left_pe cum_left_ll cum_left_hl pb_ni_pe pb_ni_ll pb_ni_hl, i(ind) j(j)
replace ind=0 if j<4 | j==10 | j==20 // ind=0 for estimates that excludes public goods spending
replace j=j-3 if ind==1 // bottom 20%: j=1; middle 20%: j=2; top 1%: j=3
replace j=4 if j==8 | j==10 // top 10%: j=4
replace j=5 if j==18 | j==20 // top 20%: j=5
sort ind j

* switching placement of top 1% and top 20%
recode j (3=5) (5=3)
sort ind j

g j2=j
* add a little "jitter"
replace j=.90 if j==1 & ind==0
replace j=1.90 if j==2 & ind==0
replace j=2.90 if j==3 & ind==0
replace j=3.90 if j==4 & ind==0
replace j=4.90 if j==5 & ind==0

replace j=1.10 if j==1 & ind==1
replace j=2.10 if j==2 & ind==1
replace j=3.10 if j==3 & ind==1
replace j=4.10 if j==4 & ind==1
replace j=5.10 if j==5 & ind==1


* Figure D7
twoway rspike bottom_inequality_ll bottom_inequality_hl j if ind==0, scheme(plotplain) lcolor(gs11) lwidth(medthick) || ///
rspike bottom_inequality_ll bottom_inequality_hl j if ind==1,  lcolor(gs11)  lwidth(medthick) || ///
scatter bottom_inequality_pe  j if ind==0, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("204 37 41") mfcolor("204 37 41") || ///
scatter bottom_inequality_pe  j  if ind==1, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("62 150 81") mfcolor("62 150 81") xlabel(1 "Bottom 20%" 2 "Middle 20%" 3 "Top 20%" 4 "Top 10%" 5 "Top 1%", nogrid labsize(medlarge) labcolor(gray)) ylabel(,labsize(medlarge) labcolor(gray)) xscale(r(0.8 4.2))  xtitle("") title("Bottom-End Inequality", size(medlarge)) legend(order(3 4 ) label(3 "excl. in-kind transfers") label(4 "incl. in-kind transfers") placement(s) si(small) region(lc(none) fc(none) ls(none)) keygap(*.5) colgap(*.25) symxs(small) c(2) pos(6))

graph save "D7b", replace

twoway rspike top_inequality_ll top_inequality_hl j if ind==0, scheme(plotplain) lcolor(gs11) lwidth(medthick) || ///
rspike top_inequality_ll top_inequality_hl j if ind==1,  lcolor(gs11)  lwidth(medthick) || ///
scatter top_inequality_pe j if ind==0, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("204 37 41") mfcolor("204 37 41") || ///
scatter top_inequality_pe j  if ind==1, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("62 150 81") mfcolor("62 150 81") xlabel(1 "Bottom 20%" 2 "Middle 20%" 3 "Top 20%" 4 "Top 10%" 5 "Top 1%", nogrid labsize(medlarge) labcolor(gray)) xscale(r(0.8 4.2))  ylabel(,labsize(medlarge) labcolor(gray))  xtitle("")  title("Top-End Inequality", size(medlarge)) legend(order(3 4 ) label(3 "excl. in-kind transfers") label(4 "incl. in-kind transfers") placement(s) si(small) region(lc(none) fc(none) ls(none)) keygap(*.5) colgap(*.25) symxs(small) c(2) pos(6))

graph save "D7a", replace

grc1leg2  "D7a" "D7b", scheme(s1mono) c(1) xsize(16) ysize(10)



*Figure D8

* fictive pe to get the two subfigures aligned.
g fic_pe=1

* Figure 5
twoway rspike cum_left_ll cum_left_hl j if ind==0, scheme(plotplain) lcolor(gs11) lwidth(medthick) || ///
rspike cum_left_ll cum_left_hl j if ind==1,  lcolor(gs11)  lwidth(medthick) || ///
scatter cum_left_pe  j if ind==0, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("204 37 41") mfcolor("204 37 41") || ///
scatter cum_left_pe  j  if ind==1, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("62 150 81") mfcolor("62 150 81") xlabel(1 "Bottom 20%" 2 "Middle 20%" 3 "Top 20%" 4 "Top 10%" 5 "Top 1%", nogrid labsize(medlarge) labcolor(gray)) ylabel(-0.6(0.2)0.4,labsize(medlarge) labcolor(gray)) xscale(r(0.85 5.15)) yscale(r(-0.6 0.4)) xtitle("") title("Cumulative Left Partisanship", size(medlarge)) legend(order(3 4 ) label(3 "excl. in-kind transfers") label(4 "incl. in-kind transfers") placement(s) si(small) region(lc(none) fc(none) ls(none)) keygap(*.5) colgap(*.25) symxs(small) c(2) pos(6)) xsize(16) 

graph save "D8a", replace


twoway rspike pb_ni_ll pb_ni_hl j2 if ind==1, scheme(plotplain)  lcolor(gs11)  lwidth(medthick) || ///
scatter fic_pe  j if ind==0, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("white") mfcolor("white") || ///
scatter fic_pe  j if ind==1, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("white") mfcolor("white") || ///
scatter pb_ni_pe  j2  if ind==1, msym(O) msize(medlarge) mlwidth(medthick) mlcolor("62 150 81") mfcolor("62 150 81") xlabel(1 "Bottom 20%" 2 "Middle 20%" 3 "Top 20%" 4 "Top 10%" 5 "Top 1%", nogrid labsize(medlarge) labcolor(gray)) ylabel(-0.6(0.2)0.4,labsize(medlarge) labcolor(gray)) xscale(r(0.85 5.15)) yscale(r(-.6 0.4)) xtitle("") title("Public Goods Consumption", size(medlarge))legend(order(4 ) label(4 "incl. in-kind transfers") placement(s) si(small) region(lc(none) fc(none) ls(none)) keygap(*.5) colgap(*.25) symxs(small) c(2) pos(6)) xsize(16) 

graph save "D8b", replace

grc1leg2  "D8a" "D8b", scheme(s1mono) c(1)

* Figure D9
use "WID_US_2021_09_03", clear
replace var="prej_" if var=="aptinc992j"
replace var="postj_" if var=="adiinc992j"
replace var="pdispj_" if var=="acainc992j"

replace var="prei_" if var=="aptinc992i"
replace var="posti_" if var=="adiinc992i"
replace var="pdispi_" if var=="acainc992i"

replace var="pret_" if var=="aptinc992t"
replace var="postt_" if var=="adiinc992t"
replace var="pdispt_" if var=="acainc992t"

gen var=variable+percentile
drop variable percentile age pop

reshape wide value, i(year country) j(var) string

foreach v of varlist value* {
   	local newname = substr("`v'", 6, .)
   	rename `v' `newname'
}

* middle quintile
g prei_p40p60= (prei_p40p50+prei_p50p60)/2
g posti_p40p60= (posti_p40p50+posti_p50p60)/2

g prej_p40p60= (prej_p40p50+prej_p50p60)/2
g postj_p40p60= (postj_p40p50+postj_p50p60)/2

* bottom quintile
g prei_b20= (prei_p0p10+prei_p10p20)/2
g posti_b20= (posti_p0p10+posti_p10p20)/2

g prej_b20= (prej_p0p10+prej_p10p20)/2
g postj_b20= (postj_p0p10+postj_p10p20)/2

drop if year<1980
sort year

* Real extended income growth
gen index_ext_L = 100*posti_b20/posti_b20[1] // baseline growth rate; base 100 = 1980
gen index_ext_M = 100*posti_p40p60/posti_p40p60[1] // baseline growth rate; base 100 = 1980
gen index_ext = 100*posti_p0p100/posti_p0p100[1] // baseline growth rate; base 100 = 1980

gen index_ext_Lj = 100*postj_b20/postj_b20[1] // baseline growth rate; base 100 = 1980
gen index_ext_Mj = 100*postj_p40p60/postj_p40p60[1] // baseline growth rate; base 100 = 1980
gen index_extj = 100*postj_p0p100/postj_p0p100[1] // baseline growth rate; base 100 = 1980

set scheme s1color
twoway line index_extj index_ext_Lj index_ext_Mj year, ylabel(, angle(horizontal)) title("Equal-split approach") legend(order (1 "Overall average" 3 "Middle 20%" 2 "Bottom 20%") r(1))

graph save "D9a", replace

twoway line index_ext index_ext_L index_ext_M year, ylabel(, angle(horizontal)) title("Individualized series") legend(order (1 "Overall average" 3 "Middle 20%" 2 "Bottom 20%") r(1))

graph save "D9b", replace

grc1leg2 "D9a" "D9b",  title("Real post-tax income growth (base 100=1980)") labsize(small)


************

* Appendix E: Alternative Model Specifications

use "data_analysis_final", clear

**** Regressions **** 
* dropping the outliers in CH in 2008 and 2009 
drop if country=="Switzerland" & year>2007 & year<2010

* labeling
label var top_inequality "T1/M20"
label var bottom_inequality_b20 "M20/B20"
label var ikaopen "Capital market openness"
label var iopenc "Trade openness"
label var cum_left "Partisanship (left)"
label var imarriage_rate "Marriage rate"
label var unemp "Unemployment"
label var pb_ni "Public goods consumption"

****
xtset ccode year
****
* Table E1: two LDVs
xtpcse d1.red_t1_disp l1.red_t1_disp l2.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls l2.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp l2.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls l2.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp l2.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls l2.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append


* Table E2: Prais-Winsten regressions
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p c(a)
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p c(a)
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p c(a)
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p  c(a)
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p c(a)
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p c(a)
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append




* Table E3: adding time trends
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode  trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode  trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode  trend, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode  trend, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode  trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append


* Table E4: adding country-specific time trends
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode##c.trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode##c.trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode##c.trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode##c.trend, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode##c.trend, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode##c.trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append



* Table E5: using the unimputed series for capital account and trade openness, and the marriage rate
xtpcse d.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.kaopen l1.kaopen d1.openc l1.openc  d1.cum_left l1.cum_left d1.marriage_rate l1.marriage_rate d1.unemp l1.unemp  i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)   lab replace

xtpcse d.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.kaopen l1.kaopen d1.openc l1.openc    d1.cum_left l1.cum_left d1.marriage_rate l1.marriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.kaopen l1.kaopen d1.openc  l1.openc    d1.cum_left l1.cum_left d1.marriage_rate l1.marriage_rate  d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_m20ls l1.red_m20ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.kaopen l1.kaopen d1.openc l1.openc    d1.cum_left l1.cum_left d1.marriage_rate l1.marriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_b20_disp l1.red_b20_disp d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.kaopen l1.kaopen d1.openc  l1.openc    d1.cum_left l1.cum_left d1.marriage_rate l1.marriage_rate  d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.kaopen l1.kaopen d1.openc l1.openc    d1.cum_left l1.cum_left d1.marriage_rate l1.marriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

* Table E6: see below


* Table E7: top 10% instead of top 1%
xtpcse d.red_t10_disp l1.red_t10_disp  d1.top_inequality_t10 l1.top_inequality_t10 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab replace

xtpcse d.red_t10ls l1.red_t10ls  d1.top_inequality_t10 l1.top_inequality_t10 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_m20_disp l1.red_m20_disp  d1.top_inequality_t10 l1.top_inequality_t10 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc  l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_m20ls l1.red_m20ls  d1.top_inequality_t10 l1.top_inequality_t10 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_b20_disp l1.red_b20_disp d1.top_inequality_t10 l1.top_inequality_t10 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc  l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_b20ls l1.red_b20ls d1.top_inequality_t10 l1.top_inequality_t10 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append



* Table E8: top 20% instead of top 1%
xtpcse d.red_t20_disp l1.red_t20_disp  d1.top_inequality_t20 l1.top_inequality_t20 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab replace

xtpcse d.red_t20ls l1.red_t20ls  d1.top_inequality_t20 l1.top_inequality_t20 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_m20_disp l1.red_m20_disp  d1.top_inequality_t20 l1.top_inequality_t20 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc  l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_m20ls l1.red_m20ls  d1.top_inequality_t20 l1.top_inequality_t20 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_b20_disp l1.red_b20_disp d1.top_inequality_t20 l1.top_inequality_t20 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc  l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp  i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append

xtpcse d.red_b20ls l1.red_b20ls d1.top_inequality_t20 l1.top_inequality_t20 d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate  d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*, +)  lab append





* Table E9: Full set of results
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append



* multiplying  absolute transfer rates by 100 to get as percentage
foreach v of varlist red_t1_abs_disp red_t1_absls red_m20_abs_disp red_m20_absls  red_b20_abs_disp red_b20_absls {
	replace `v'=`v'*100
}
* Table E10: absolute transfer shares
xtpcse d1.red_t1_abs_disp l1.red_t1_abs_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1_absls l1.red_t1_absls   d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode , p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_abs_disp l1.red_m20_abs_disp d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode , p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_absls l1.red_m20_absls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode , p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_abs_disp l1.red_b20_abs_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode , p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_absls l1.red_b20_absls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode , p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append


* Table E11: one-way FE
xtpcse red_t1_disp l1.red_t1_disp l2.red_t1_disp   top_inequality  bottom_inequality_b20  ikaopen  iopenc   cum_left  imarriage_rate unemp i.ccode
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse red_t1ls l1.red_t1ls l2.red_t1ls   top_inequality  bottom_inequality_b20  ikaopen  iopenc     cum_left  imarriage_rate  unemp  pb_ni i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse red_m20_disp l1.red_m20_disp l2.red_m20_disp   top_inequality  bottom_inequality_b20  ikaopen   iopenc     cum_left  imarriage_rate  unemp i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse red_m20ls l1.red_m20ls l2.red_m20ls   top_inequality  bottom_inequality_b20  ikaopen  iopenc     cum_left  imarriage_rate   unemp pb_ni i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse red_b20_disp l1.red_b20_disp l2.red_b20_disp  top_inequality  bottom_inequality_b20  ikaopen   iopenc     cum_left  imarriage_rate  unemp i.ccode
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse red_b20ls l1.red_b20ls l2.red_b20ls  top_inequality  bottom_inequality_b20  ikaopen  iopenc     cum_left  imarriage_rate  unemp  pb_ni i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append


* Table E12: twoway-way FE
xtpcse red_t1_disp l1.red_t1_disp l2.red_t1_disp   top_inequality  bottom_inequality_b20  ikaopen  iopenc   cum_left  imarriage_rate unemp i.year i.ccode
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+) lab replace

xtpcse red_t1ls l1.red_t1ls l2.red_t1ls   top_inequality  bottom_inequality_b20  ikaopen  iopenc     cum_left  imarriage_rate  unemp  pb_ni i.year i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+) lab append

xtpcse red_m20_disp l1.red_m20_disp l2.red_m20_disp   top_inequality  bottom_inequality_b20  ikaopen   iopenc     cum_left  imarriage_rate  unemp i.year i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+) lab append

xtpcse red_m20ls l1.red_m20ls l2.red_m20ls   top_inequality  bottom_inequality_b20  ikaopen  iopenc     cum_left  imarriage_rate  unemp  pb_ni i.year i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+) lab append

xtpcse red_b20_disp l1.red_b20_disp l2.red_b20_disp  top_inequality  bottom_inequality_b20  ikaopen   iopenc     cum_left  imarriage_rate  unemp i.year i.ccode
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+) lab append

xtpcse red_b20ls l1.red_b20ls l2.red_b20ls  top_inequality  bottom_inequality_b20  ikaopen  iopenc     cum_left  imarriage_rate  unemp pb_ni i.year i.ccode 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+) lab append



* Table E13: only health distributed as an equal lump-sum; the rest of in-kind benefits is distributed proportional to post-tax disposable income.
xtpcse d1.red_t1 l1.red_t1  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+)  lab replace

xtpcse d1.red_t1 l1.red_t1  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+)  lab append

xtpcse d1.red_m20 l1.red_m20 d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+)  lab append

xtpcse d1.red_m20 l1.red_m20 d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode trend, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+)  lab append

xtpcse d1.red_b20 l1.red_b20 d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+)  lab append

xtpcse d1.red_b20 l1.red_b20 d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode trend, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05, 0.1) symbol(*,+)  lab append


* Table E14: including extra controls for share of elderly, female labor force participation, and union density
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.elderly l1.elderly d1.ifemale_labor l1.ifemale_labor d1.ud_ipol l1.ud_ipol i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.elderly l1.elderly d1.ifemale_labor l1.ifemale_labor d1.ud_ipol l1.ud_ipol d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.elderly l1.elderly d1.ifemale_labor l1.ifemale_labor d1.ud_ipol l1.ud_ipol i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.elderly l1.elderly d1.ifemale_labor l1.ifemale_labor d1.ud_ipol l1.ud_ipol d1.pb_ni l1.pb_ni i.ccode, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.elderly l1.elderly d1.ifemale_labor d1.ud_ipol l1.ud_ipol l1.ifemale_labor i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.elderly l1.elderly d1.ifemale_labor l1.ifemale_labor d1.ud_ipol l1.ud_ipol d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append





* Results when including the outliers from Switzerland
use "data_analysis_final", clear

* labeling
label var top_inequality "T1/M20"
label var bottom_inequality_b20 "M20/B20"
label var ikaopen "Capital market openness"
label var iopenc "Trade openness"
label var cum_left "Partisanship (left)"
label var imarriage_rate "Marriage rate"
label var unemp "Unemployment"
label var pb_ni "Public goods consumption"

****
xtset ccode year
****

* Table E6: including the two outliers
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append



** Results when including house prices as control
** Real house price index
import delimited "HOUSE_PRICES_05012022172459514.csv", clear 
keep country time value

split time, parse("-") generate(year)
keep if year2==""
ren year1 year
destring year, replace

drop year2 time
ren value house_price


merge 1:1 country year using "data_analysis_final"

keep if _merge==3

drop if country=="Switzerland" & year>2007 & year<2010

****
xtset ccode year
****

label var top_inequality "T1/M20"
label var bottom_inequality_b20 "M20/B20"
label var ikaopen "Capital market openness"
label var iopenc "Trade openness"
label var cum_left "Partisanship (left)"
label var imarriage_rate "Marriage rate"
label var unemp "Unemployment"
label var pb_ni "Public goods consumption"
label var house_price "House price index"

* Table E15: including house price index as control
xtpcse d1.red_t1_disp l1.red_t1_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.house_price l1.house_price i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab replace

xtpcse d1.red_t1ls l1.red_t1ls  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni d1.house_price l1.house_price i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20_disp l1.red_m20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.house_price l1.house_price i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_m20ls l1.red_m20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni d1.house_price l1.house_price i.ccode, p  
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20_disp l1.red_b20_disp  d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc  d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.house_price l1.house_price i.ccode, p
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append

xtpcse d1.red_b20ls l1.red_b20ls d1.top_inequality l1.top_inequality d1.bottom_inequality_b20 l1.bottom_inequality_b20 d1.ikaopen l1.ikaopen d1.iopenc l1.iopenc    d1.cum_left l1.cum_left d1.imarriage_rate l1.imarriage_rate d1.unemp l1.unemp d1.pb_ni l1.pb_ni d1.house_price l1.house_price i.ccode, p 
outreg2 using regressions,  word  bd(2) sd(2) rd(2) alpha(0.05) symbol(*)  lab append
